import Request from '../common/js/request'

class WorkOrderApply {
  /**
   * 获取当前登录用户常用流程
   */
  static getCommonlyFlowList() {
    const url = '/api-workflow/commonlyFlow/getCommonlyFlowList'

    return Request.get(url)
  }

  /**
   * 添加常用流程
   * @param keys 定义keys
   */
  static insertCommonlyFlow(keys) {
    const url = '/api-workflow/commonlyFlow/insertCommonlyFlow'

    const data = {
      keys: keys.toString()
    }

    return Request.post(url, data)
  }

  /**
   * 启动流程实例
   * @param key 流程key
   * @param content 数据内容
   */
  static startProcessInstance(key, content) {
    const url = '/api-workflow/runtime/startProcessInstance'

    const data = {
      key,
      content
    }

    return Request.post(url, data)
  }
}

export default WorkOrderApply
